package com.ruoyi.group.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.group.domain.RpQuestionType;
import com.ruoyi.group.service.HelpOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:黄志超
 * @Todo:工单帮助查询全部工单
 * @DateTime:2022/3/14 15:34
 * @Component:蜗牛
 **/
@RestController
@RequestMapping("/help")
public class HelpOrderController extends BaseController {
    @Autowired
    HelpOrderService helpOrderService;

    @PostMapping("/findOrder")
    public TableDataInfo tableDataInfo( RpQuestionType rpQuestionType) {

        startPage();
        List<RpQuestionType> list = helpOrderService.findOrder(rpQuestionType);
       return getDataTable(list);
    }

    @PostMapping("/insert")
    public AjaxResult ajaxResult(@RequestBody RpQuestionType rpQuestionType) {
        if (helpOrderService.insert(rpQuestionType)) {
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }

}
